﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom.Compiler;

namespace RobotBattle2.Scripting {
	public sealed class ReturnStatement : Statement {
		public ReturnStatement() { }
		public ReturnStatement(Expression value) {
			this.Value = value;
		}

		public Expression Value { get; set; }

		public override void Dump(IndentedTextWriter writer) {
			writer.Write("return");
			if (Value != null) {
				writer.Write('(');
				Value.Dump(writer);
				writer.Write(')');
			}
			writer.WriteLine(';');
		}

		public override StatementType Type { get { return StatementType.Return; } }
	}
}
